Kanzi 3.9.10
kanzi::DefaultLogger Class Reference

Use this class to access the Default Logger. More...

#include <kanzi/core/log/default_logger.hpp>

Static Public Member Functions

static AbstractLoggerget ()
 Gets the reference to the Default Logger object.
 
static void popAllLoggers ()
 Removes all custom loggers registered within the Default Logger object.
 
static void popLogger ()
 Removes the last pushed logger from the Default Logger object.
 
static void pushLogger (AbstractLoggerUniquePtr &&logger)
 Pushes a custom logger to the Default Logger object.
 

Detailed Description

Use this class to access the Default Logger.

The Default Logger inherits from kanzi::AbstractLogger. It is a container for an arbitrary number of other loggers.

To add a logger to the Default Logger object, use pushLogger. The implementation of the AbstractLogger::writeOverride function in the Default Logger writes log messages to all the loggers that the Default Logger contains.

To remove the last added logger from the Default Logger, use popLogger. To remove all loggers from the Default Logger, use popAllLoggers.

To get the reference to the Default Logger object, use get.

The Logging macros use the Default Logger to write log messages.

Member Function Documentation

◆ pushLogger()

static void kanzi::DefaultLogger::pushLogger ( AbstractLoggerUniquePtr && logger)
static

Pushes a custom logger to the Default Logger object.

Use this function to append a new custom logger to be used by the Default Logger to write log messages.

Parameters
loggernew logger to be registered within default logger.

◆ popLogger()

static void kanzi::DefaultLogger::popLogger ( )
static

Removes the last pushed logger from the Default Logger object.

When you no longer need the logger which was last pushed to the Default Logger object, use this function to remove that logger.

◆ popAllLoggers()

static void kanzi::DefaultLogger::popAllLoggers ( )
static

Removes all custom loggers registered within the Default Logger object.

When you call this function, all custom loggers that were pushed with pushLogger() are popped from the Default Logger object. After you call this function, the log messages written using the Default Logger object are not written anywhere.

◆ get()

static AbstractLogger & kanzi::DefaultLogger::get ( )
static

Gets the reference to the Default Logger object.

Returns
Default Logger object.

The documentation for this class was generated from the following file: